home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_FixExtraLabel.c < prev    next >
C/C++ Source or Header  |  1996-03-18  |  2KB  |  73 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #ifdef DO_MENUS
  15.  
  16.     /* LTP_FixExtraLabel(RootMenu *Root,LONG *Error):
  17.      *
  18.      *    Fix up the submenu indicators and command labels.
  19.      */
  20.  
  21. VOID
  22. LTP_FixExtraLabel(RootMenu *Root,LONG *ErrorPtr)
  23. {
  24.     ItemNode    *Item;
  25.     LONG         Error = 0;
  26.  
  27.         // Now take care of items which have command sequences
  28.         // or submenu items attached
  29.  
  30.     for(Item = (ItemNode *)Root->ItemList.mlh_Head ; !Error && Item->Node.mln_Succ ; Item = (ItemNode *)Item->Node.mln_Succ)
  31.     {
  32.             // Does this one need more label data?
  33.  
  34.         if(Item->Flags & (ITEMF_HasSub | ITEMF_Command))
  35.         {
  36.             struct IntuiText *IntuiText;
  37.  
  38.             DB(kprintf("  attach to |%s|\n",((struct IntuiText *)Item->Item.ItemFill)->IText));
  39.  
  40.                 // Make room for the extra label data
  41.  
  42.             if(IntuiText = AsmAllocPooled(Root->Pool,sizeof(struct IntuiText),SysBase))
  43.             {
  44.                     // Fill it in
  45.  
  46.                 LTP_InitIText(Root,IntuiText);
  47.  
  48.                     // Command sequence?
  49.  
  50.                 if(Item->ExtraLabel)
  51.                 {
  52.                     IntuiText->IText        = Item->ExtraLabel;
  53.                     IntuiText->ITextFont    = (struct TextAttr *)&Root->BoldAttr;
  54.                 }
  55.                 else
  56.                     IntuiText->IText = (STRPTR)"»";
  57.  
  58.                 IntuiText->TopEdge = (Root->ItemHeight - Root->RPort.TxHeight) / 2;;
  59.  
  60.                     // Link to previous entry
  61.  
  62.                 ((struct IntuiText *)Item->Item.ItemFill)->NextText = IntuiText;
  63.             }
  64.             else
  65.                 Error = ERROR_NO_FREE_STORE;
  66.         }
  67.     }
  68.  
  69.     *ErrorPtr = Error;
  70. }
  71.  
  72. #endif    /* DO_MENUS */
  73.